import 'dart:io';

import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pocketfile/common/utlis/shared_preferences_utils.dart';
import 'package:pocketfile/module/home/utils/method_channel_utils.dart';
import 'package:pocketfile/routes/app_pages.dart';

void main() {
  //沉浸式状态栏
  if (Platform.isAndroid) {
    SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
        statusBarIconBrightness: Brightness.dark));
  }
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    SharedPreferencesUtils.init();
    MethodChannelUtils.getInstance().init('com.shengdan.pocket_file.pocketfile');

    return ScreenUtilInit(
      builder: (BuildContext context, Widget? child) {
        return GetMaterialApp(
          debugShowCheckedModeBanner: true,
          title: "口袋文件",
          getPages: AppPages.routes,
          initialRoute: AppPages.INITIAL,
          locale: const Locale('zh', 'CN'),
          //设置默认语言
          fallbackLocale: const Locale("zh", "CN"), // 在配置错误的情况下,使用的语言
        );
      },
      designSize: const Size(375, 812),
      minTextAdapt: true,
      splitScreenMode: true,
    );
  }
}
